package main

import "fmt"

func main() {
	list := []int{5,2,3,1}
	bubbl(list)
	fmt.Println(list)
}

func bubbl(list []int) {

	for end := len(list); end > 0; end-- {
		//sortedIndex := 1
		for begin := 1; begin < end; begin++ {

			if list[begin] < list[begin-1] {
				list[begin], list[begin-1] = list[begin-1], list[begin]
				//sortedIndex = begin
			}
		}
		//end = sortedIndex

	}
}
